<SecretListHeader
  @isCertTab={{eq tab "certs"}}
  @model={{model}}
  @baseKey={{baseKey}}
  @backendCrumb={{backendCrumb}}
  @filter={{filter}}
/>
<div class="box is-fullwidth is-shadowless has-tall-padding">
  {{#if showEmptyState}}
    <EmptyState
      @title='Connect a database'
      @message={{emptyStateMessage}}
    >
      {{#if (or model.connectionCapabilities.canCreate model.connectionCapabilities.canUpdate)}}
        <SecretLink @mode="create" @secret="" @queryParams={{query-params initialKey=(or filter baseKey.id) itemType=tab}} @class="link" @data-test-secret-create="connections">
          Connect a database
        </SecretLink>
      {{/if}}
    </EmptyState>
  {{else}}
    <div class="selectable-card-container {{if (and (eq model.connections 403) (eq model.roles 403)) 'one-card'}}">
      {{#if model.connectionCapabilities.canList}}
        <SelectableCard
          @cardTitle="Connections"
          @total={{if (eq model.connections 404) 0 model.connections.length}}
          @subText="The total number of connections to external databases that you have access to."
          @actionCard={{true}}
          @actionText="Configure new"
          @actionTo="vault.cluster.secrets.backend.create-root"
          @queryParam={{'connection'}}
        />
      {{/if}}
      {{#if (or model.roleCapabilities.canList model.staticRoleCapabilities.canList) }}
        <SelectableCard
          @cardTitle="Roles"
          @total={{if (eq model.roles 404) 0 model.roles.length}}
          {{!-- TODO: Messaging needs massaging --}}
          @subText="The total number of roles that have been set up that you can list."
          @actionCard={{true}}
          @actionText="Create new"
          @actionTo="vault.cluster.secrets.backend.create-root"
          @queryParam={{'role'}}
        />
      {{/if}}
      <GetCredentialsCard 
        @title="Get Credentials"
        @searchLabel="Role to use"
        @backend={{model.backend}}
        @models={{array 'database/role'}}
      />
    </div>
  {{/if}}
</div>
